<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<style>
#div1 {width:350px;height:70px;padding:10px;border:1px solid #aaaaaa;}
#drag1{width:170px;height:36px;display:block;}
</style>
</head>
<body>
<p>Drag the following text into the rectangle:</p>
<div id="div1"></div>
<br>
<div id="drag1" draggable="true">Drag me</div>
<pre id="console"></pre>
<script>
    window.jsTestIsAsync = true;
    description("Test that drop event generates user gesture");

    function drop() {
        // Consume user gesture.
        shouldBeDefined("window.open('about:blank')");
        finishJSTest();
    }

    function allowDrop(ev) {
        ev.preventDefault();
    }

    document.getElementById("div1").addEventListener("dragover", allowDrop);
    document.getElementById("div1").addEventListener("drop", drop);

    if (window.eventSender) {
        var drag = document.querySelector("#drag1");
        eventSender.mouseMoveTo(drag.offsetLeft + 10, drag.offsetTop + 5);
        eventSender.mouseDown();
        eventSender.leapForward(100);
        eventSender.mouseMoveTo(drag.offsetLeft + 10, drag.offsetTop - 30);
        eventSender.mouseUp();
    }
</script>
</body>
</html>
